package com.txunda.zhuohired.adapter.user.news;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.bean.user.my.SystemInfoBean;

import java.util.List;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/6 10:50
 * 功能描述：系统通知adapter
 * 联系方式：jiahuanchen@126.com
 */

public class SystemInformAdapter extends BaseAdapter {
    private Context context;
    private ViewHolder holder;
    private List<SystemInfoBean.DataBean> mList;

    public SystemInformAdapter(Context context,List<SystemInfoBean.DataBean> systemList) {
        this.context = context;
        this.mList = systemList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return mList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_system_inform, null);
            holder = new ViewHolder();
            view.setTag(holder);
            ViewUtils.inject(holder, view);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tv_system_time .setText( mList.get(i).getCreate_time());
        holder.tv_system_title.setText(mList.get(i).getSys_msg_title());
        holder.tv_system_content.setText(mList.get(i).getSys_msg_info());
        return view;
    }

    class ViewHolder {
        @ViewInject(R.id.tv_system_time)
        TextView tv_system_time;
        @ViewInject(R.id.tv_system_title)
        TextView tv_system_title;
        @ViewInject(R.id.tv_system_content)
        TextView tv_system_content;
    }
}
